﻿@model IEnumerable<sqlflashcards.Models.Flashcard>
@{
    ViewBag.Title = "SQL Flashcards - List";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<script type="text/javascript" language="javascript">


    $(function () {

        $('a.showanswer').click(function () {
            $(this).parent().parent().find('.answerIndex').toggle();
            return false;
        });

    });

</script>
<h2>
</h2>
<br />
<br />
<div id="flashcardStuff">
    <p>
        @Html.ActionLink("Add Card", "AddNew", "Home")
    </p>
    <table>
        <tr>
            
            <th class="sourceTable">
            </th>
            <th>
                ID
            </th>
            <th class="questionTable">
                question
            </th>
            <th class="sourceTable">
                source
            </th>
            <th class="sourceLinkList">
                sourceLink
            </th>
            <th class="answerIndex">
                answer
            </th>
        </tr>
        @foreach (var item in Model)
        {
            <tr class="listItem">
                
                <td class="sourceTable">
                    @Html.ActionLink("Edit", "Edit", new { CardId = item.sysID }) |
                    @Html.ActionLink("Show Card", "Index", new { cardId = (item.sysID).ToString(), direction = "Next" })
                    <a href="" class="showanswer">Show Answer</a>
                </td>
                <td>
                    @item.sysID
                </td>
                <td class="questionTable">
                    @item.question
                </td>
                <td class="sourceTable">
                    @item.source
                </td>
                <td class="sourceLinkList">
                    <a href="@item.sourceLink">Source Link</a>
                </td>
                <td class="answerIndex">
                    @MvcHtmlString.Create(Html.Encode(item.answer).Replace(Environment.NewLine, "<br />"))
                </td>
            </tr>
        }
    </table>
</div>
